﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using InnovaApp.Layers.ResourcesLayer.Properties;
using INNOVACALL.Framework.Common.Models.ViewModels.MetaModels;

namespace InnovaApp.Layers.CommonLayer.Controllers
{
    public static class Environment
    {
        static string eMethodBase = "InnovaApp.Layers.CommonLayer.Controllers.Environment";
        /// <summary>
        /// JQueryUI Theme, returns Smothness if AppSetting not set
        /// </summary>
        public static string JQueryUITheme
        {
            get
            {
                string toReturn = "Smoothness"; //Light Grey
                try
                {
                    toReturn = ConfigurationManager.AppSettings["JQueryUITheme"];
                }
                catch (Exception) { };
                return toReturn;
            }
        }

        /// <summary>
        /// KendoUI Theme, returns Smothness if AppSetting not set
        /// </summary>
        public static string KendoUITheme
        {
            get
            {
                string toReturn = "Default"; //Light Grey
                try
                {
                    toReturn = ConfigurationManager.AppSettings["KendoUITheme"];
                }
                catch (Exception) { };
                return toReturn;
            }
        }

        /// <summary>
        /// Default language, returns en-us if AppSetting not set
        /// </summary>
        public static string DefaultLanguage
        {
            get
            {
                string toReturn = "en-us"; //Light Grey
                try
                {
                    toReturn = ConfigurationManager.AppSettings["DefaultLanguage"];
                }
                catch (Exception) { };
                return toReturn;
            }
        }

        public static string Languages
        {
            get
            {
                return ConfigurationManager.AppSettings["Languages"];
            }
        }

        /// <summary>
        /// Languages list
        /// </summary>
        public static List<Language_MetaModel> lstLanguages
        {
            get
            {
                List<Language_MetaModel> toReturn;
                string eMethod = eMethodBase + "lstLanguages{get}";
                try
                {
                    toReturn = Languages.Split(',').Select(x => new Language_MetaModel(x)).ToList();
                }
                catch (Exception ex)
                {
                    throw new INNOVACALL.Framework.Common.InnovacallExceptions.InitializationException(eMethod, null, Resources.ErrMsg_Initialization_LanguageListError);
                }
                return toReturn;
            }
        }
        /// <summary>
        /// Dynamic content minimum height in pixels
        /// </summary>
        public static int ContentMinHeight
        {
            get
            {
                int toReturn = 600;
                int.TryParse(ConfigurationManager.AppSettings["ContentMinHeight"], out toReturn);
                return toReturn;
            }
        }

        /// <summary>
        /// Dynamic content minimum with in pixel
        /// </summary>
        public static object ContentMinWidth
        {
            get
            {
                int toReturn = 800;
                int.TryParse(ConfigurationManager.AppSettings["ContentMinWidth"], out toReturn);
                return toReturn;
            }
        }
        /// <summary>
        /// Base namespace to search dyna content controllers
        /// </summary>
        public static string DynaContentControllersBaseNamespace
        {
            get
            {

                string toReturn = string.Empty;
                toReturn = ConfigurationManager.AppSettings["DynaContentControllersBaseNamespace"];
                return toReturn;
            }
        }
        /// <summary>
        /// Base namespace to search controllers to add to the menu editor list
        /// </summary>
        public static string CustomControllersBaseNamespace
        {
            get
            {
                string toReturn = string.Empty;
                toReturn = ConfigurationManager.AppSettings["CustomControllersBaseNamespace"];
                return toReturn;
            }
        }
    }
}